﻿package {
	import flash.display.*;
	import flash.events.*;

	public class orbit extends AsteriodMC {

		public function orbit(jX:Number, jY:Number, jk:Number) {

			addEventListener(Event.ENTER_FRAME, onLoop);
			var angle:Number=0;
			var radius:Number=jk;
			var angleChange:Number=3;
			var midX:Number=jX;
			var midY:Number=jY;

			function onLoop(evt:Event):void {

				var radian:Number=deg2rad(angle);
				x=midX+radius*Math.cos(radian);
				y=midY+radius*Math.sin(radian);
				angle+=angleChange;
				angle%=360;
			}
			function deg2rad(deg:Number):Number {
				return deg * (Math.PI/180);
			}

		}

	}
}